namespace SharpPlanetsModel {

  public abstract class Ship: SpaceObject//, SharpPlanets.IPlanet
  {

    ///<label>contains</label>
    Rocket rocket;
    protected System.Drawing.Image shipImage;

    public void Shoot() {
    }

    override public void Paint(System.Drawing.Graphics graph) {
      if (shipImage != null) {
        //int RealWidth = (int)(graph.ClipBounds.Width);
        //int RealWidth = 320;
        int width = (int)(2 * Configuration.fieldWidthInPixels / 100);
        int height = (int)(1 * Configuration.fieldWidthInPixels / 100);
        int hlx = this.CenterPosition.getXRel(Configuration.fieldWidthInPixels) - width;
        int hly = this.CenterPosition.getYRel(Configuration.fieldWidthInPixels) - height;
        System.Drawing.Rectangle srcRect = new System.Drawing.Rectangle(0, 0, 20, 9);
        System.Drawing.Rectangle destRect = new System.Drawing.Rectangle(hlx, hly, 2 * width, 2 * height);
        System.Drawing.GraphicsUnit myUnits = System.Drawing.GraphicsUnit.Pixel;// System.Drawing.GraphicsUnit myUnits = System.Drawing.GraphicsUnit.Pixel;
        graph.DrawImage(shipImage, destRect, srcRect, myUnits);
        //graph.DrawImage(shipImage, myRect);
      }
    }

    abstract protected void setupImage();

    public bool Collide(Position pos) {
      int Xdistance = this.CenterPosition.getXAbs() - pos.getXAbs();
      int Ydistance = this.CenterPosition.getYAbs() - pos.getYAbs();
      double distance = System.Math.Sqrt(System.Math.Pow(Xdistance, 2) + System.Math.Pow(Ydistance, 2));
      if (distance > Configuration.shipCollisionThreshold) {
        return false;
      }
      else {
        return true;
      }
    }
  }
}
